<template>
    <Layout>
        <Form ref="form1" :model="queryParam" :label-width="120">
            <Row :gutter="16" class="query-form2" v-show="!switchFlag">
                <Col span="8">
                    <FormItem label="项目名称：" prop="projectName">
                        <Input class="query-form-el" type="text" v-model="queryParam.projectName"></Input>
                    </FormItem>
                </Col>
                <Col span="8">
                    <FormItem label="责任单位：">
                        <Input class="query-form-el" type="text" v-model="queryParam.dutyOrgName"></Input>
                    </FormItem>
                </Col>
                <Col span="8">
                    <div style="float: right;">
                        <Button class="ivu-btn-query" icon="md-search" @click="query">查询</Button>
                        <Button class="ivu-btn-reset" style="margin-left: 10px" @click="cancel">重置</Button>
                    </div>
                </Col>
            </Row>
            <Row v-show="switchFlag" class="query-form">
                <Col span="8">
                    <FormItem label="项目名称：" prop="projectName">
                        <Input class="query-form-el" type="text" v-model="queryParam.projectName"></Input>
                    </FormItem>
                </Col>
                <Col span="8">
                    <FormItem label="责任单位：" prop="dutyOrgName">
                        <Input class="query-form-el" type="text" v-model="queryParam.dutyOrgName"></Input>
                    </FormItem>
                </Col>
                <Col span="8">
                    <FormItem label="项目性质：">
                        <Select v-model="queryParam.projectNature">
                            <Option v-for="item in projectNatureMaps" :value="item.codingCodeId" :key="item.codingCodeId">
                                {{item.codingName}}
                            </Option>
                        </Select>
                    </FormItem>
                </Col>
            </Row>
            <Row v-show="switchFlag" class="query-form">
                <Col span="8">
                    <FormItem label="项目级别：">
                        <Select v-model="queryParam.projectLevel">
                            <Option v-for="item in projectLevelMaps" :value="item.codingCodeId" :key="item.codingCodeId">
                                {{item.codingName}}
                            </Option>
                        </Select>
                    </FormItem>
                </Col>
                <Col span="8">
                </Col>
                <Col span="8">
                    <Button @click="switchQuery(false)" class="ivu-btn-switch" type="text">收起∧</Button>
                    <Button @click="reset" class="ivu-btn-reset">重置</Button>
                    <Button class="ivu-btn-query" icon="md-search" @click="query">查询</Button>
                </Col>
            </Row>
        </Form>
        <Row class="query-form">
            <Col span="24">
                <Button size="large" class="ivu-btn-add"  @click="queryEnvironmental">环保水保可研设计</Button>
                <Button size="large" class="ivu-btn-add"  @click="queryHealth">职业卫生可研设计</Button>
                <Button size="large" class="ivu-btn-add"  @click="querySafe">安全可研设计</Button>
                <Button size="large" class="ivu-btn-add"  @click="queryEnergy">节能评估可研设计</Button>
            </Col>
        </Row>

        <Table ref='table' :height="tableHeight" :loading="loading" @on-selection-change='getSelectRows'
               border :columns="columns1" :data="dataTable">
        </Table>

        <Row style="margin-right:10px;">
            <Col span="24">
                <Page style="float: right" :total="pagedata.total" :page-size="pagedata.pageSize"
                      @on-change="pageChange" @on-page-size-change="pageSizeChange" :page-size-opts="pageSizeArray"
                      show-total show-sizer show-elevator/>
            </Col>
        </Row>

        <Modal :title="titleName" :transfer=false v-model="environmentalVisible" :width=1200 
            class-name='limit-height-dialog' :styles="{height:'520px'}" @on-cancel="onCancel">
            <Row>
                <Col span="24">
                    <Form  ref="threeSimEnvironmentalDatas" :model="threeSimEnvironmentalDatas" :rules="ruleCustom" label-position="left">
                        <Row :gutter="16" type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                            <label style="font-weight:900;font-size:16px">试生产阶段资料</label>
                            </Col>
                            <Col span="11">
                            </Col>
                        </Row>
                        <br>
                        <Row :gutter="16" type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label="环保监理单位">
                                    <Input type="text" v-model="form1.planName"/>
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label="环保监测单位">
                                   <Input type="text" v-model="form1.planName"/>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row :gutter="16" type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label="环保监理报告">
                                    <Input >
                                        <Button slot="append"  class="ivu-btn-add"  @click="uploadFile('environmental','soilWaterGovermentReply')">上传</Button>
                                    </Input>
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label="环保监测数据文件">
                                    <Input >
                                        <Button slot="append"  class="ivu-btn-add"  @click="uploadFile('environmental','soilWaterGovermentReply')">上传</Button>
                                    </Input>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row :gutter="16" type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label="水土保持监理单位">
                                    <Input type="text" v-model="form1.planName"/>
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label="水土保持监测单位">
                                   <Input type="text" v-model="form1.planName"/>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row :gutter="16" type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label="水土保持补偿费（元）">
                                    <Input type="text" v-model="form1.planName"/>
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label="水土保持监理报告">
                                   <Input >
                                        <Button slot="append"  class="ivu-btn-add"  @click="uploadFile('environmental','soilWaterGovermentReply')">上传</Button>
                                    </Input>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row :gutter="16" type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label="水土保持监测数据文件">
                                    <Input >
                                        <Button slot="append"  class="ivu-btn-add"  @click="uploadFile('environmental','soilWaterGovermentReply')">上传</Button>
                                    </Input>
                                </FormItem>
                            </Col>
                            <Col span="11">
                            </Col>
                        </Row>
                        <Row :gutter="16" type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                            <label style="font-weight:900;font-size:16px">竣工验收阶段资料</label>
                            </Col>
                            <Col span="11">
                            </Col>
                        </Row>
                        <br>
                        <Row :gutter="16" type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label="环保竣工验收报告">
                                    <Input type="text" v-model="form1.planName"/>
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label="环保竣工验收备案表">
                                   <Input type="text" v-model="form1.planName"/>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row :gutter="16" type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label="水土保持验收报告">
                                    <Input >
                                        <Button slot="append"  class="ivu-btn-add"  @click="uploadFile('environmental','soilWaterGovermentReply')">上传</Button>
                                    </Input>
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label="水土保持地方验收批复">
                                    <Input >
                                        <Button slot="append"  class="ivu-btn-add"  @click="uploadFile('environmental','soilWaterGovermentReply')">上传</Button>
                                    </Input>
                                </FormItem>
                            </Col>
                        </Row>
                    </Form>
                </Col>
            </Row>           
            <div slot="footer">
                <Button @click="submit('threeSimEnvironmentalDatas','environmental')" class="ivu-btn-save" :loading="buttonLoading">确定</Button>
                <Button @click="onCancel" class="ivu-btn-cancel">取消</Button>
            </div>
        </Modal>

        <Modal :title="titleName" :transfer=false v-model="healthVisible" :width=1200 
            class-name='limit-height-dialog' :styles="{height:'520px'}" @on-cancel="onCancel">
            <Row>
                <Col span="24">
                    <Form  ref="threeSimHealthData" :model="threeSimHealthData" :rules="ruleCustom" label-position="top">
                        <Row :gutter="16" type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label="评价单位">
                                    <Input type="text" v-model="form1.planName"/>
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label="主要职业病危害因素">
                                    <Input type="text" v-model="form1.planName"/>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row :gutter="16" type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label="职业病危险因素影响程度">
                                    <Input type="text" v-model="form1.planName"/>
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label="职业病防护专项投资预算（万元）">
                                    <Input type="text" v-model="form1.planName"/>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row :gutter="16" type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                            <label style="font-weight:900;font-size:16px">可研阶段资料</label>
                            </Col>
                            <Col span="11">
                            </Col>
                        </Row>
                        <br>
                        <Row :gutter="16" type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label="预评价报告">
                                    <Input >
                                        <Button slot="append"  class="ivu-btn-add"  @click="uploadFile('environmental','soilWaterGovermentReply')">上传</Button>
                                    </Input>
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label="评价方案">
                                    <Input >
                                        <Button slot="append"  class="ivu-btn-add"  @click="uploadFile('environmental','soilWaterGovermentReply')">上传</Button>
                                    </Input>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row :gutter="16" type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label="建设单位意见">
                                    <Input >
                                        <Button slot="append"  class="ivu-btn-add"  @click="uploadFile('environmental','soilWaterGovermentReply')">上传</Button>
                                    </Input>
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label="专家组验收意见">
                                    <Input >
                                        <Button slot="append"  class="ivu-btn-add"  @click="uploadFile('environmental','soilWaterGovermentReply')">上传</Button>
                                    </Input>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row :gutter="16" type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label="报告修改确认材料">
                                    <Input >
                                        <Button slot="append"  class="ivu-btn-add"  @click="uploadFile('environmental','soilWaterGovermentReply')">上传</Button>
                                    </Input>
                                </FormItem>
                            </Col>
                            <Col span="11">
                            </Col>
                        </Row>
                        <Row :gutter="16" type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                            <label style="font-weight:900;font-size:16px">设计阶段资料</label>
                            </Col>
                            <Col span="11">
                            </Col>
                        </Row>
                        <br>
                        <Row :gutter="16" type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label="防护设施设计文件">
                                    <Input >
                                        <Button slot="append"  class="ivu-btn-add"  @click="uploadFile('environmental','soilWaterGovermentReply')">上传</Button>
                                    </Input>
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label="评价方案">
                                    <Input >
                                        <Button slot="append"  class="ivu-btn-add"  @click="uploadFile('environmental','soilWaterGovermentReply')">上传</Button>
                                    </Input>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row :gutter="16" type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label="建设单位意见">
                                    <Input >
                                        <Button slot="append"  class="ivu-btn-add"  @click="uploadFile('environmental','soilWaterGovermentReply')">上传</Button>
                                    </Input>
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label="专家组意见">
                                    <Input >
                                        <Button slot="append"  class="ivu-btn-add"  @click="uploadFile('environmental','soilWaterGovermentReply')">上传</Button>
                                    </Input>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row :gutter="16" type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label="报告修改确认材料">
                                    <Input >
                                        <Button slot="append"  class="ivu-btn-add"  @click="uploadFile('environmental','soilWaterGovermentReply')">上传</Button>
                                    </Input>
                                </FormItem>
                            </Col>
                            <Col span="11">
                            </Col>
                        </Row>
                    </Form>
                </Col>
            </Row>           
            <div slot="footer">
                <Button @click="submit('threeSimEnvironmentalDatas','environmental')" class="ivu-btn-save" :loading="buttonLoading">确定</Button>
                <Button @click="onCancel" class="ivu-btn-cancel">取消</Button>
            </div>
        </Modal>

        <Modal :title="titleName" :transfer=false v-model="seafVisible" :width=1200 
            class-name='limit-height-dialog' :styles="{height:'500px'}" @on-cancel="onCancel">
            <Row>
                <Col span="24">
                    <Form  ref="threeSimSeafData" :model="threeSimSeafData" :rules="ruleCustom" label-position="top">
                        <Row :gutter="16" type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label="预评价报告编制单位：">
                                    <Input type="text" v-model="form1.planName"/>
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label="预评价报告审查完成时间">
                                    <DatePicker type="date" placeholder="选择时间" v-model="form1.startTime" style="width: 100%"></DatePicker>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row :gutter="16" type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label="预评价报告">
                                    <Input >
                                        <Button slot="append"  class="ivu-btn-add"  @click="uploadFile('environmental','soilWaterGovermentReply')">上传</Button>
                                    </Input>
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label="预评价报告审查意见">
                                    <Input >
                                        <Button slot="append"  class="ivu-btn-add"  @click="uploadFile('environmental','soilWaterGovermentReply')">上传</Button>
                                    </Input>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row :gutter="16" type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                            <label style="font-weight:900;font-size:16px">设计阶段资料</label>
                            </Col>
                            <Col span="11">
                            </Col>
                        </Row>
                        <br>
                        <Row :gutter="16" type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label="安全设施设计单位">
                                    <Input type="text" v-model="form1.planName"/>
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label="安全设施设计批复时间">
                                    <DatePicker type="date" placeholder="选择时间" v-model="form1.startTime" style="width: 100%"></DatePicker>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row :gutter="16" type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label="安全设施设计报告">
                                    <Input >
                                        <Button slot="append"  class="ivu-btn-add"  @click="uploadFile('environmental','soilWaterGovermentReply')">上传</Button>
                                    </Input>
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label="安全设施设计批复文件">
                                    <Input >
                                        <Button slot="append"  class="ivu-btn-add"  @click="uploadFile('environmental','soilWaterGovermentReply')">上传</Button>
                                    </Input>
                                </FormItem>
                            </Col>
                        </Row>
                    </Form>
                </Col>
            </Row>           
            <div slot="footer">
                <Button @click="submit('threeSimEnvironmentalDatas','environmental')" class="ivu-btn-save" :loading="buttonLoading">确定</Button>
                <Button @click="onCancel" class="ivu-btn-cancel">取消</Button>
            </div>
        </Modal>

        <Modal :title="titleName" :transfer=false v-model="energyVisible" :width=1200 
            class-name='limit-height-dialog' :styles="{height:'520px'}" @on-cancel="onCancel">
            <Row>
                <Col span="24">
                    <Form  ref="threeSimEnergyData" :model="threeSimEnergyData" :rules="ruleCustom" label-position="top">
                        <Row :gutter="16" type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label="节能报告编制单位">
                                    <Input type="text" v-model="form1.planName"/>
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label="股份公司内部审查时间">
                                    <DatePicker type="date" placeholder="选择时间" v-model="form1.startTime" style="width: 100%"></DatePicker>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row :gutter="16" type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label="股份公司内部审查节能报告">
                                    <Input >
                                        <Button slot="append"  class="ivu-btn-add"  @click="uploadFile('environmental','soilWaterGovermentReply')">上传</Button>
                                    </Input>
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label="股份公司内部审查纪要">
                                    <Input >
                                        <Button slot="append"  class="ivu-btn-add"  @click="uploadFile('environmental','soilWaterGovermentReply')">上传</Button>
                                    </Input>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row :gutter="16" type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label="政府审查机构">
                                    <Input type="text" v-model="form1.planName"/>
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label="地方政府审查节能报告">
                                    <Input >
                                        <Button slot="append"  class="ivu-btn-add"  @click="uploadFile('environmental','soilWaterGovermentReply')">上传</Button>
                                    </Input>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row :gutter="16" type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label="优化措施实现节能量（吨标准煤）">
                                    <Input type="text" v-model="form1.planName"/>
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label="优化措施实现节约投资（万元）">
                                    <Input type="text" v-model="form1.planName"/>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row :gutter="16" type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label="政府审查时间">
                                    <DatePicker type="date" placeholder="选择时间" v-model="form1.startTime" style="width: 100%"></DatePicker>
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label="地方政府审查批复文件">
                                    <Input >
                                        <Button slot="append"  class="ivu-btn-add"  @click="uploadFile('environmental','soilWaterGovermentReply')">上传</Button>
                                    </Input>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row :gutter="16" type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label="优化措施实现节水量（万立方米）">
                                    <Input type="text" v-model="form1.planName"/>
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label="项目评估优化措施明细">
                                    <Input >
                                        <Button slot="append"  class="ivu-btn-add"  @click="uploadFile('environmental','soilWaterGovermentReply')">上传</Button>
                                    </Input>
                                </FormItem>
                            </Col>
                        </Row>
                    </Form>
                </Col>
            </Row>           
            <div slot="footer">
                <Button @click="submit('threeSimEnvironmentalDatas','environmental')" class="ivu-btn-save" :loading="buttonLoading">确定</Button>
                <Button @click="onCancel" class="ivu-btn-cancel">取消</Button>
            </div>
        </Modal>

        <Modal title="三同时详情" class="modal-view-detail" 
              :styles="{height:'520px'}":transfer=false v-model="model2" :width=900>
            <Row>
                <Col span="24">
                    <Form :model="showdata" :label-width="100">
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="23">
                                <FormItem label="项目名称：" prop="projectName">
                                     {{showdata.projectName}}
                                </FormItem>
                            </Col>
                        </Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="23">
                                <FormItem label="项目基本情况：" prop="projectDesc">
                                    {{showdata.projectDesc}}
                                </FormItem>
                            </Col>
                        </Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label="责任单位：" prop="dutyOrgId">
                                     {{showdata.dutyOrgName}}
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label="项目设计单位：" prop="designUnit">
                                     {{showdata.designUnit}}
                                </FormItem>
                            </Col>
                        </Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label="项目性质：" prop="projectNature">
                                      {{showdata.projectNatureName}}
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label="项目分类：" prop="projectCategory">
                                     {{showdata.projectCategoryName}}
                                </FormItem>
                            </Col>
                        </Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label="项目级别：" prop="projectLevel">
                                     {{showdata.projectLevelName}}
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label="所在行政区域：" prop="administrativeMap">
                                     {{showdata.administrativeMap}}
                                </FormItem>
                            </Col>
                        </Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label="立项时间：" prop="establishmentTime">
                                    {{showdata.establishmentTime}}
                                </FormItem>
                            </Col>
                            <Col span="11">
                            </Col>
                        </Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label="计划开工时间：" prop="startTime">
                                     {{showdata.startTime}}
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label="计划完工时间：" prop="endTime">
                                     {{showdata.endTime}}
                                </FormItem>
                            </Col>
                        </Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label="总投资（万元）：" prop="totalInvestment">
                                     {{showdata.totalInvestment}}
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label="年综合能源消耗量：" prop="powerConsumption">
                                     {{showdata.powerConsumption}}
                                </FormItem>
                            </Col>
                        </Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label="项目负责人：" prop="projectLeader">
                                     {{showdata.projectLeader}}
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label="联系电话：" prop="contactPhone">
                                    {{showdata.contactPhone}}
                                </FormItem>
                            </Col>
                        </Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="23">
                                <FormItem label="三同时类型：" prop="projectType">
                                    <CheckboxGroup v-model="showdata.projectType">
                                        <Checkbox label="1" disabled>环保水保三同时</Checkbox>
                                        <Checkbox label="2" disabled>职业卫生三同时</Checkbox>
                                        <Checkbox label="3" disabled>安全三同时</Checkbox>
                                        <Checkbox label="4" disabled>节能评估三同时</Checkbox>
                                    </CheckboxGroup>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="23">
                                <FormItem label="备注：" prop="remark">
                                    {{showdata.remark}}
                                </FormItem>
                            </Col>
                        </Row>
                    </Form>
                </Col>
            </Row>
            <div slot="footer">
                <Button class='ivu-btn-save' @click="model2=false">关闭</Button>
            </div>
        </Modal>
    </layout>
</template>

<script>
    import {Api} from '../../../api/index.js'
    import cascaderDom from '../../../components/cascader-dom'
    import {sessionStorage} from '../../../common/cacheUtils.js';
    import pageCommonFunction from '@/components/pageCommonFunction.js'

    export default {
        components: {
            cascaderDom
        },
        data() {
            return {
                queryParam: {projectName:"",dutyOrgName:'',projectLevel:'',projectNature:''},
                environmentalVisible:false,
                healthVisible:false,
                seafVisible:false,
                energyVisible:false,
                threeSimEnvironmentalDatas:[{}],
                threeSimHealthData:[{}],
                form1:{},
                isUpdate:false,
                switchFlag: false,
                projectCategoryMaps:{},
                projectLevelMaps:{},
                projectNatureMaps:{},
                projectNatures:[],
                projectLevels:[],
                projectNatures:[],
                pageSizeArray: [10, 20, 50],
                pagedata: {
                    total: 0,
                    pageSize: 10,
                    currentPage: 1,
                },
                columns1: [
                    {
                        title: "序号",
                        width: 80,
                        align: "center",
                        fixed: 'left',
                        render: (h, params) => {
                            return h('span', params.index + (this.pagedata.currentPage - 1) * this.pagedata.pageSize + 1);
                        }
                    },
                    {
                        minWidth: 220,
                        title: '计划名称',
                        key: 'projectName',
                        align: 'center'
                    },
                    {
                        minWidth: 220,
                        title: '责任单位',
                        key: 'dutyOrgName',
                        align: 'center'
                    },
                    {
                        minWidth: 220,
                        title: '项目设计单位',
                        key: 'designUnit',
                        align: 'center'
                    },
                     {
                        minWidth: 220,
                        title: '项目性质',
                        key: 'projectNature',
                        align: 'center',
                        render:(h, params)=>{
                            return h('span', this.projectNatureMaps && this.projectNatureMaps[params.row.projectNature] && this.projectNatureMaps[params.row.projectNature].codingName)
                        },
                    },
                    {
                        minWidth: 220,
                        title: '项目分类',
                        key: 'projectCategory',
                        align: 'center',
                        render:(h, params)=>{
                            return h('span', this.projectCategoryMaps && this.projectCategoryMaps[params.row.projectCategory] && this.projectCategoryMaps[params.row.projectCategory].codingName)
                        },
                    },
                    {
                        minWidth: 220,
                        title: '项目级别',
                        key: 'projectLevel',
                        align: 'center',
                        render:(h, params)=>{
                            return h('span', this.projectLevelMaps && this.projectLevelMaps[params.row.projectLevel] && this.projectLevelMaps[params.row.projectLevel].codingName)
                        },
                    },
                    {
                        minWidth: 220,
                        title: '所在行政区域',
                        key: 'administrativeMap',
                        align: 'center',
                        render: (h, params) =>{ return 
                            h('span', this.areaCodeToAreaName(params.row.administrativeMap)); 
                        },
                    },
                    {
                        minWidth: 220,
                        title: '总投资（万元）',
                        key: 'totalInvestment',
                        align: 'center'
                    },
                    {
                        minWidth: 220,
                        title: '年综合能源消耗量（吨标准煤）',
                        key: 'powerConsumption',
                        align: 'center'
                    },
                    {
                        minWidth: 220,
                        title: '立项时间',
                        key: 'establishmentTime',
                        align: 'center',
                        render: (h, params) => {
                            return h('span', this.formatDate(new Date(params.row.establishmentTime),"yyyy-MM-dd"));
                        }
                    },
                    {
                        minWidth: 130,
                        title: '计划开工时间',
                        key: 'startTime',
                        align: 'center',
                        render: (h, params) => {
                            return h('span', this.formatDate(new Date(params.row.startTime),"yyyy-MM-dd"));
                        }
                    },
                    {
                        minWidth: 130,
                        title: '计划完工时间',
                        key: 'endTime',
                        align: 'center',
                        render: (h, params) => {
                            return h('span', this.formatDate(new Date(params.row.endTime),"yyyy-MM-dd"));
                        }
                    },
                    {
                        minWidth: 130,
                        title: '环境',
                        key: 'checkCycle',
                        align: 'center',
                        render: (h, params) => {
                             return h('span', params.row.isEnvironmental=='1'?'√':'×');
                        }
                    },
                    {
                        minWidth: 130,
                        title: '职业卫生',
                        key: 'health',
                        align: 'center',
                        render: (h, params) => {
                            return h('span', params.row.isHealth=='1'?'√':'×');
                        }
                    },
                    {
                        minWidth: 130,
                        title: '安全',
                        key: 'safe',
                        align: 'center',
                        render: (h, params) => {
                            return h('span', params.row.isSafe=='1'?'√':'×');
                        }
                    },
                    {
                        minWidth: 130,
                        title: '节能评估',
                        key: 'energySaving',
                        align: 'center',
                        render: (h, params) => {
                            return h('span', params.row.isEnergy=='1'?'√':'×');
                        }
                    },
                    {
                        minWidth: 130,
                        title: '联系电话',
                        key: 'contactPhone',
                        align: 'center'
                    },
                    {
                        minWidth: 130,
                        title: '立项状态',
                        key: 'projectStatus',
                        align: 'center',
                        render: (h, params) => {
                            
                        }
                    },
                    {
                        title: '操作',
                        key: 'action',
                        fixed: 'right',
                        minWidth: 200,
                        align: 'center',
                        render: (h, params) => {
                            return h('div', [
                                h('A', {
                                    props: {
                                        type: 'primary',
                                        size: 'small'
                                    },
                                    style: {
                                        fontSize: '14px',
                                    },
                                    on: {
                                        click: () => {
                                            this.viewInfo(params.row);
                                        }
                                    }
                                }, '详情'),
                                h('Divider', {
                                    props: {
                                        type: 'vertical',
                                    }
                                }, ''),
                                h('A', {
                                    props: {
                                        type: 'primary',
                                        size: 'small'
                                    },
                                    style: {
                                        fontSize: '14px',
                                        color: (this.currentUserId != params.row.createUserId&&this.loginId != 'admin') ? '#d0d0d0':'',
                                        pointerEvents:  (this.currentUserId != params.row.createUserId &&this.loginId != 'admin')? 'none':''
                                    },
                                    on: {
                                        click: () => {
                                            this.updateInfo(params.row);
                                        }
                                    }
                                }, '修改'),
                                h('Divider', {
                                    props: {
                                        type: 'vertical',
                                    }
                                }, ''),
                                h('A', {
                                    props: {
                                        type: 'error',
                                        size: 'small'
                                    },
                                    style: {
                                        fontSize: '14px',
                                         color: (this.currentUserId != params.row.createUserId &&this.loginId != 'admin') ? '#d0d0d0':'red',
                                         pointerEvents:  (this.currentUserId != params.row.createUserId&&this.loginId !='admin') ? 'none':''
                                    },
                                    on: {
                                        click: () => {
                                            this.deleteInfo(params.row);
                                        }
                                    }
                                }, '删除')
                            ]);
                        }
                    }
                ],
                ruleCustom: {
                    planName: [{required: true, message: '  ', trigger: 'blur,change'}],
                    planDate: [{required: true, message: '  ', trigger: 'blur,change', pattern: /.+/ }],
                    screenOrgId: [{required: true, message: '  ', trigger: 'blur'}],
                    screenPositionId: [{required: true, message: '  ', trigger: 'blur'}]
                },
                modal1: false,
                add: false,
                titleName:'',
                loading: false,
                tableHeight: '',
                dataTable: [],
                showdata:{},
                currentUser: sessionStorage('userId').getObject('userId'),
                currentUserId: sessionStorage('userId').getObject('userId').userId,
                rootOrgId:''
            }
        },
        mounted(){
            this.rootOrgId =  sessionStorage('userId').getObject('userId').companyId;
            this.tableHeight = window.innerHeight - this.$refs.table.$el.offsetTop - 145;
            this.query();
            this.$http.get(Api.queryCodeDetailBySortId + '/STS-000001', {params: {}}).then((res) => {
                this.projectLevelMaps = this.dictListToMap(res.data.data);
                this.projectLevels = res.data.data;
            });
            this.$http.get(Api.queryCodeDetailBySortId + '/STS-000002', {params: {}}).then((res) => {
                this.projectNatureMaps = this.dictListToMap(res.data.data);
                this.projectNatures = res.data.data;
            });
            this.$http.get(Api.queryCodeDetailBySortId + '/STS-000003', {params: {}}).then((res) => {
                this.projectCategoryMaps = this.dictListToMap(res.data.data);
                this.projectCategorys = res.data.data;
            });
        },
        methods: {
            ...pageCommonFunction,
            query(){
                this.loading = true;
                let data = {
                    startPage: this.pagedata.currentPage,
                    size: this.pagedata.pageSize,
                }
                data = Object.assign(data,JSON.parse(JSON.stringify(this.queryParam)));
                this.$http.get(Api.threeSimProjectList, {
                    params: data
                }).then(function(res){
                    this.dataTable = res.data.data.data;
                    this.pagedata.total = res.data.data.totalSize;
                    this.loading = false;
                }, function(res){
                    this.$Message.error('请求失败');
                    this.loading = false;
                });
            },
            submit(name,type) {
                this.$refs[name].validate((valid) => {
                    if (valid) {
                        if(type == 'environmental'){
                            this.buttonLoading = true
                            if (this.isUpdate) {
                                let url = Api.threeSimEnvironment
                                this.$http.put(url, this.threeSimEnvironmentalDatas).then((res) => {
                                    if(res.data.status == 200){
                                        this.$Message.success('成功');
                                        this.query()
                                        this.buttonLoading = false
                                        this.model1 = false
                                    }else{
                                        this.$Message.error('请求失败');
                                    }
                                }).catch(e => {
                                    this.$Message.error('请求失败');
                                })
                            } else {
                                let url = Api.threeSimEnvironment;
                                this.$http.post(url, this.threeSimEnvironmentalDatas).then((res) => {
                                    if(res.data.status == 200){
                                        this.$Message.success('成功');
                                        this.query()
                                        this.buttonLoading = false
                                        this.model1 = false
                                    }else{
                                        this.$Message.error('请求失败');
                                    }
                                }).catch(e => {
                                    this.$Message.error('请求失败');
                                })
                            }
                        }
                    }
                })
            },
            pageSizeChange(pageSize){
                this.pagedata.pageSize = pageSize;
                this.query();
            },
            pageChange(pageNum){
                this.pagedata.currentPage = pageNum;
                this.query();
            },
            reset(){
                this.queryParam =  {projectName:"",dutyOrgName:'',projectLevel:'',projectNature:''}
                this.query();
            },
            onCancel(){
                this.environmentalVisible = false;
                this.healthVisible = false;
                this.seafVisible = false;
                this.energyVisible = false;
            },
            switchQuery(flag){
                this.switchFlag = flag;
                if (!this.switchFlag) {
                    this.tableHeight = this.tableHeight + 44;
                } else {
                    this.tableHeight = this.tableHeight - 44;
                }
            },
            queryEnvironmental(){
                this.isUpdate = false;
                this.environmentalVisible = true;
                this.titleName = "新增";
                this.threeSimEnvironmentalDatas = [{
                        createUserId: this.currentUser.userId,
                        createOrgId:this.currentUser.orgInfo.orgId,         
                        createDate: new Date(),
                        createDateStr: this.formatDate(new Date()),
                        bsflag:'0',
                        type:'0',
                        typeName:'环境影响评价',
                        remark:''
                    },  
                    {
                        createUserId: this.currentUser.userId,
                        createOrgId:this.currentUser.orgInfo.orgId,         
                        createDate: new Date(),
                        createDateStr: this.formatDate(new Date()),
                        bsflag:'0',
                        type:'2',
                        typeName:'环保竣工验收',
                        remark:''
                    },  
                    {
                        createUserId: this.currentUser.userId,
                        createOrgId:this.currentUser.orgInfo.orgId,         
                        createDate: new Date(),
                        createDateStr: this.formatDate(new Date()),
                        bsflag:'0',
                        type:'3',
                        typeName:'水土保持评价',
                        remark:''
                    },  
                    {
                        createUserId: this.currentUser.userId,
                        createOrgId:this.currentUser.orgInfo.orgId,         
                        createDate: new Date(),
                        createDateStr: this.formatDate(new Date()),
                        bsflag:'0',
                        type:'4',
                        typeName:'水土保持验收',
                        remark:''
                    },    
                ]
            },
            queryHealth(){
                this.isUpdate = false;
                this.healthVisible = true;
                this.titleName = "新增";
            },
            querySafe(){
                this.isUpdate = false;
                this.seafVisible = true;
                this.titleName = "新增";
            },
            queryEnergy(){
                this.isUpdate = false;
                this.energyVisible = true;
                this.titleName = "新增";
            },
            updateInfo(row){
                this.isUpdate = true;
                this.form1 = row;
                this.form1.projectType = [];
                if( this.form1.isEnergy = '1')
                    this.form1.projectType.push('4')
                if( this.form1.isEnvironmental = '1')
                    this.form1.projectType.push('1')
                if( this.form1.isHealth = '1')
                    this.form1.projectType.push('2')
                if( this.form1.isSafe = '1')
                    this.form1.projectType.push('3')
                this.form1.updateOrgId = this.currentUser.orgInfo.orgId,
                this.form1.updateUserId = this.currentUser.userId;
                this.form1.updateDate = new Date(),
                this.titleName = "修改";
                this.modal1 = true;
            },
            viewInfo(row){
                this.showdata = row;
                this.showdata.projectType = [];
                if( this.showdata.isEnergy = '1')
                    this.showdata.projectType.push('4')
                if( this.showdata.isEnvironmental = '1')
                    this.showdata.projectType.push('1')
                if( this.showdata.isHealth = '1')
                    this.showdata.projectType.push('2')
                if( this.showdata.isSafe = '1')
                    this.showdata.projectType.push('3')
                this.model2 = true;
            },
            setOrgId(data) {
                this.dataToQuery.orgId= data[data.length - 1];
            },
            setOrgName(data) {
                this.dataToQuery.orgName = data;
            },
            deleteInfo(row){
                this.$Modal.confirm({
                    title: '数据删除',
                    content: '<p>确定删除该条信息</p>',
                    okText: '确认',
                    onOk: () => {
                        this.$http.delete(Api.threeSimProject + "/" + row.projectId, {params:{
                                updateUserId: this.currentUser.userId
                            }}).then((res) => {
                            this.$Message.success({content:'删除成功',duration: 4});
                            this.query();
                        })
                    },
                    cancelText: '取消'
                });
            },
            queryProjectNatureList(){
                this.$http.get(Api.projectNatureMaps).then((res) => {
                    if(res.data.status == 200){
                        this.projectNatureMaps = res.data.data;
                    }
                }).catch(e => {
                    this.$Message.error("附件删除失败");
                });
            },
            queryProjectLevelList(){
                this.$http.get(Api.projectLevelMaps).then((res) => {
                    if(res.data.status == 200){
                        this.projectLevelMaps = res.data.data;
                    }
                }).catch(e => {
                    this.$Message.error("附件删除失败");
                });
            },
            queryProjectCategoryList(){
                this.$http.get(Api.projectCategoryMaps).then((res) => {
                    if(res.data.status == 200){
                        this.projectCategoryMaps = res.data.data;
                    }
                }).catch(e => {
                    this.$Message.error("附件删除失败");
                });
            },
            formatDate(date, fmt) {
                if (typeof date == 'string') {
                    return date;
                }
                if (!fmt) fmt = "yyyy-MM-dd hh:mm:ss";
                if (!date || date == null) return null;
                let o = {
                    'M+': date.getMonth() + 1, // 月份
                    'd+': date.getDate(), // 日
                    'h+': date.getHours(), // 小时
                    'm+': date.getMinutes(), // 分
                    's+': date.getSeconds(), // 秒
                    'q+': Math.floor((date.getMonth() + 3) / 3), // 季度
                    'S': date.getMilliseconds() // 毫秒
                }
                if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
                for (let k in o) {
                    if (new RegExp('(' + k + ')').test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
                }
                return fmt
            },
            uuid() {
                let s = [];
                let hexDigits = "0123456789abcdef";
                for(let i = 0; i < 32; i++) {
                    s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
                }
                s[14] = "4"; // bits 12-15 of the time_hi_and_version field to 0010
                s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
                let uuid = s.join("");
                return uuid
            },
        }
    }
</script>